<template>
		<view class="photo-wall" >
			<view class="photo" v-for="(item, index) in imgList" :key="index" :style="{left: index>17?positionL[index%18] + 'rpx':positionL[index] + 'rpx', top: index>17?positionT[index%18] + (1270*parseInt(index/18)) + 'rpx':positionT[index] + 'rpx'}">
				<image :src="item.signatureUrl" mode="widthFix" @click="toDetail(item.accountId, item.accountType)"></image>
				<view class="create-time">{{formatTime(item.createTime)}}</view>
			</view>
		</view>
</template>
<script lang="ts" >
  import {defineComponent} from 'vue'
    import {
    router,
    useService,
    useConfig,
    useRouter,
    setToken,
    setUserInfo,
    getUserInfo,
    serviceKey,
  } from '@/plugins/app-core'
    

	export default defineComponent({
		data () {
			return {
				pageNum: 1,
				imgList: [],
				total: 0,
				type: '',
				// 签名图片随机排列，以定位的方式
				positionL: [42, 267, 529, 60, 343, 548, 167, 385, 20, 300, 530, 88, 440, 258, 520, 38, 482, 266],
				positionT: [40, 125, 89, 279, 272, 277, 485, 418, 620, 630, 566, 774, 800, 900,  960, 974, 1120, 1070]
			}
		},
		onLoad (options:any) {
			this.type = options.type
			switch(this.type) {
				// case 2: this.nav.navTitle = '共享投资经理承诺签名'; break;
				// case 3: this.nav.navTitle = '共享投资机构承诺签名'; break;
				// case 4: this.nav.navTitle = '孵化园承诺签名'; break;
				// case 5: this.nav.navTitle = '创业者承诺签名'; break;
				// case 7: this.nav.navTitle = '创业者承诺签名'; break;\
			}
      this.getData()

		},
		onShow() {
			this.pageNum = 1
			this.imgList = []
		},
		methods: {
      async getData(){
        const service = useService()
        let data = await service.mine.getSignatureList({})
        console.log(data)
        this.imgList = data.records
      },
			formatTime (time:any) {
				if (!time) return ''
				let arr = time.split(':')
				return arr[0] + ':' + arr[1]
			},
			toDetail (accountId:any, accountType:any) {
				let url = ''
				uni.navigateTo({
					url: url
				})
			}
		},
		// 上拉加载
		onReachBottom(){
			uni.showLoading({
				title: '拼命加载中'
			});
			// 判断是否已经加载完了
			if(this.imgList.length >= this.total){
				uni.hideLoading()
				uni.showToast({
					title:'已经加载全部了'
				})
			} else {
				this.pageNum++
				// this.getSignatureImg()
			}
		}
	})
</script>

<style lang="scss">
	.content {
		padding: 20rpx 0;
	}
	.photo-wall {
		position: relative;
		min-height: 100vh;
		overflow: hidden;
		background-image: url();
		background-repeat: repeat;
		.photo {
			position: absolute;
			width: 188rpx;
			text-align: center;
			background: url() no-repeat 60% 0rpx;
			background-size: 80rpx 80rpx;
			image {
				width: 100%;
        max-height: 115rpx;
			}
			.create-time {
				font-size: 22rpx;
				color: #A0A2A5;
			}
		}
	}
</style>